/*******************************************************************************
 *    系统名称   : 约汗乐动力接口/后台管理系统
 *    客户             : 约汗乐动力
 *    文件名        ： DateShow.java
 *              (C) Copyright 博智乐创 Corporation 2015
 *               All Rights Reserved.
 *              http://www.bozlc.com
 * *****************************************************************************
 *    注意： 本内容仅限于约汗乐动力软件公司内部使用，未经许可禁止转发
 ******************************************************************************/
package com.xiake.utils;

import java.util.Calendar;
import java.util.Date;

// TODO: Auto-generated Javadoc
/**
 * The Class DateShow.
 *
 * @author 齐龙
 * @createdate 2015-4-25
 */
public class DateShow {
    
    /**
     * Gets the page date time.
     *
     * @param date the date
     * @return the page date time
     */
    public static String getPageDateTime(Date date) {
        String dateTime = "";
        if (date == null) {
            return dateTime;
        }
        Calendar cal = Calendar.getInstance();
        int nowTimeDay = cal.get(Calendar.DAY_OF_YEAR);

        long dateMill = date.getTime();
        cal.setTimeInMillis(dateMill);
        int dateTimeDay = cal.get(Calendar.DAY_OF_YEAR);

        if (nowTimeDay == dateTimeDay) {
            dateTime = DateUtils.parseStringFromDate(date, "HH:mm");

        } else if (nowTimeDay - 1 == dateTimeDay) {
            dateTime = "昨天";
        } else {
            dateTime = DateUtils.parseStringFromDate(date, "MM-dd");
        }
        return dateTime;
    }

}
